#include "ddrc_init.h"
/**************************************LP4 DMC DTMG**************************************/

/*******************NOTE**************************
*1.DTMG11:Set MRW register during dfs
*		  Eg:0x0b55_0b55=>0b:MR11 MR_value=0x55,MR11:DRAM ODT (DQ & CA)
*         If you want change DRAM odt value you should change
		  DDRC_XX_ODT_XXX in dram_support.h
*
*************************************************/
/*-------------1866--------------------*/
#define DMC_LP4_1866_MR1			0x64
#define DMC_LP4_1866_MR2			0x36
#define DMC_LP4_1866_MR3			0x33
#define DMC_LP4_1866_MR22			0x35

#define	DMC_LP4_1866_DTMG0			0x4B161313
#if LP4X_ODT_EN(7)
#define	DMC_LP4_1866_DTMG1_LP4X			0x84161405
#else
#define	DMC_LP4_1866_DTMG1_LP4X			0x84161405
#endif
#if LP4_ODT_EN(7)
#define	DMC_LP4_1866_DTMG1_LP4			0x84161405
#else
#define	DMC_LP4_1866_DTMG1_LP4			0x84161405
#endif
#define	DMC_LP4_1866_DTMG2			0x555378AF
#define	DMC_LP4_1866_DTMG3			0xE70D252B
#define	DMC_LP4_1866_DTMG4			0x22831908
#define	DMC_LP4_1866_DTMG5			0x00000809
#define	DMC_LP4_1866_DTMG6			0x00001210
#define	DMC_LP4_1866_DTMG7			0x005F074A
#define	DMC_LP4_1866_DTMG8			0x23A6011f
#define	DMC_LP4_1866_DTMG9			0x00030EA0
#define	DMC_LP4_1866_DTMG10			0x151C0002
/*LPDDR4X*/
#if LP4X_ODT_EN(7)
#define	DMC_LP4_1866_DTMG11_LP4X		0x0b000b00//0x0b55_xxxx MR11 ODT_value
#define	DMC_LP4_1866_DTMG12_LP4X		0x163d0e5d
#else
#define	DMC_LP4_1866_DTMG11_LP4X		0x0b050b05
#define	DMC_LP4_1866_DTMG12_LP4X		0x16360e15
#endif
/*LPDDR4*/
#if LP4_ODT_EN(7)
#define	DMC_LP4_1866_DTMG11_LP4			0x0b050b05
#define	DMC_LP4_1866_DTMG12_LP4			0x163E0e11
#else
#define	DMC_LP4_1866_DTMG11_LP4			0x0b050b05
#define	DMC_LP4_1866_DTMG12_LP4			0x163E0e11
#endif
#define	DMC_LP4_1866_DTMG13			0x01640236
#define	DMC_LP4_1866_DTMG14			0x0D080C5D
#define	DMC_LP4_1866_DTMG15			0x01640236
#define	DMC_LP4_1866_DTMG16			0x0d000164
#define	DMC_LP4_1866_DTMG17			0x00000000

#define	DMC_LP4_1866_DTMG18			0x000d0383
#define	DMC_LP4_1866_DTMG19			0xFFFFFFFF


/*---------------1536------------------*/
#define DMC_LP4_1536_MR1			0x54
#define DMC_LP4_1536_MR2			0x2d
#define DMC_LP4_1536_MR3			0x33
#define DMC_LP4_1536_MR22			0x35

#define DMC_LP4_1536_DTMG0			0x49120F0F
#if LP4X_ODT_EN(6)
#define DMC_LP4_1536_DTMG1_LP4X			0x73131104
#else
#define DMC_LP4_1536_DTMG1_LP4X			0x73131104
#endif
#if LP4_ODT_EN(6)
#define DMC_LP4_1536_DTMG1_LP4			0x73131104
#else
#define DMC_LP4_1536_DTMG1_LP4			0x73131104
#endif
#define DMC_LP4_1536_DTMG2			0x47446890
#define DMC_LP4_1536_DTMG3			0xc60a1f23
#define DMC_LP4_1536_DTMG4			0x22731807
#define DMC_LP4_1536_DTMG5			0x00000708
#define DMC_LP4_1536_DTMG6			0x0000100e
#define DMC_LP4_1536_DTMG7			0x004F0600
#define DMC_LP4_1536_DTMG8			0x2301011f
#define DMC_LP4_1536_DTMG9			0x00030c00
#define DMC_LP4_1536_DTMG10			0x15180002
#if LP4X_ODT_EN(6)
#define DMC_LP4_1536_DTMG11_LP4X		0x0b000b00
#define DMC_LP4_1536_DTMG12_LP4X		0x163d0e5d
#else
#define DMC_LP4_1536_DTMG11_LP4X		0x0b050b05
#define DMC_LP4_1536_DTMG12_LP4X		0x16360e15
#endif
#if LP4_ODT_EN(6)
#define DMC_LP4_1536_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1536_DTMG12_LP4			0x163E0e11
#else
#define DMC_LP4_1536_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1536_DTMG12_LP4			0x163E0e11
#endif

#define DMC_LP4_1536_DTMG13			0x0154022d
#define DMC_LP4_1536_DTMG14			0x0D080C5D
#define DMC_LP4_1536_DTMG15			0x0154022d
#define DMC_LP4_1536_DTMG16			0x0D000154
#define DMC_LP4_1536_DTMG17			0x00000000
#define DMC_LP4_1536_DTMG18			0x000d0383
#define DMC_LP4_1536_DTMG19			0xffffffff



/*---------------1333------------------*/
#define DMC_LP4_1333_MR1			0x44
#define DMC_LP4_1333_MR2			0x24
#define DMC_LP4_1333_MR3			0x33
#define DMC_LP4_1333_MR22			0x3D

#define DMC_LP4_1333_DTMG0			0x48100D0D
#if LP4X_ODT_EN(5)
#define DMC_LP4_1333_DTMG1_LP4X			0x72100F03
#else
#define DMC_LP4_1333_DTMG1_LP4X			0x72100F03
#endif
#if LP4_ODT_EN(5)
#define DMC_LP4_1333_DTMG1_LP4			0x72100F03
#else
#define DMC_LP4_1333_DTMG1_LP4			0x72100F03
#endif
#define DMC_LP4_1333_DTMG2			0x3d3b5c7D
#define DMC_LP4_1333_DTMG3			0xA5091B1F
#define DMC_LP4_1333_DTMG4			0x22631706
#define DMC_LP4_1333_DTMG5			0x00000607
#define DMC_LP4_1333_DTMG6			0x00000D0C
#define DMC_LP4_1333_DTMG7			0x00430535
#define DMC_LP4_1333_DTMG8			0x229C0100
#define DMC_LP4_1333_DTMG9			0x00030A70
#define DMC_LP4_1333_DTMG10			0x15140002
#if LP4X_ODT_EN(5)
#define DMC_LP4_1333_DTMG11_LP4X		0x0b000b00
#define DMC_LP4_1333_DTMG12_LP4X		0x163d0e5d
#else
#define DMC_LP4_1333_DTMG11_LP4X		0x0b050b05
#define DMC_LP4_1333_DTMG12_LP4X		0x16360e15
#endif
#if LP4_ODT_EN(5)
#define DMC_LP4_1333_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1333_DTMG12_LP4			0x163e0e11
#else
#define DMC_LP4_1333_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1333_DTMG12_LP4			0x163e0e11
#endif
#define DMC_LP4_1333_DTMG13			0x01440224
#define DMC_LP4_1333_DTMG14			0x0D080C5D
#define DMC_LP4_1333_DTMG15			0x01440224
#define DMC_LP4_1333_DTMG16			0x0D000144
#define DMC_LP4_1333_DTMG17			0x00000000
#define DMC_LP4_1333_DTMG18			0x000d0383
#define DMC_LP4_1333_DTMG19			0xFFFFFFFF



/*---------------1024------------------*/
#define DMC_LP4_1024_MR1			0x34
#define DMC_LP4_1024_MR2			0x1b
#define DMC_LP4_1024_MR3			0x33
#define DMC_LP4_1024_MR22			0x3E

#define DMC_LP4_1024_DTMG0			0x460C0A0A
#if LP4X_ODT_EN(4)
#define DMC_LP4_1024_DTMG1_LP4X			0x520e0d02
#else
#define DMC_LP4_1024_DTMG1_LP4X			0x520e0d02
#endif
#if LP4_ODT_EN(4)
#define DMC_LP4_1024_DTMG1_LP4			0x520e0d02
#else
#define DMC_LP4_1024_DTMG1_LP4			0x520e0d02
#endif
#define DMC_LP4_1024_DTMG2			0x302d4c60
#define DMC_LP4_1024_DTMG3			0x84071418
#define DMC_LP4_1024_DTMG4			0x22531605
#define DMC_LP4_1024_DTMG5			0x00000506
#define DMC_LP4_1024_DTMG6			0x00000b0a
#define DMC_LP4_1024_DTMG7			0x00350400
#define DMC_LP4_1024_DTMG8			0x12010100
#define DMC_LP4_1024_DTMG9			0x00030690
#define DMC_LP4_1024_DTMG10			0x15100002
#if LP4X_ODT_EN(4)
#define DMC_LP4_1024_DTMG11_LP4X		0x0b000b00
#define DMC_LP4_1024_DTMG12_LP4X		0x163d0e5d
#else
#define DMC_LP4_1024_DTMG11_LP4X		0x0b050b05
#define DMC_LP4_1024_DTMG12_LP4X		0x16360e15
#endif
#if LP4_ODT_EN(4)
#define DMC_LP4_1024_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1024_DTMG12_LP4			0x163e0e11
#else
#define DMC_LP4_1024_DTMG11_LP4			0x0b050b05
#define DMC_LP4_1024_DTMG12_LP4			0x163e0e11
#endif
#define DMC_LP4_1024_DTMG13			0x0134021b
#define DMC_LP4_1024_DTMG14			0x0d080c5d
#define DMC_LP4_1024_DTMG15			0x0134021B
#define DMC_LP4_1024_DTMG16			0x0d000134
#define DMC_LP4_1024_DTMG17			0x00000000
#define DMC_LP4_1024_DTMG18			0x000d0383
#define DMC_LP4_1024_DTMG19			0xFFFFFFFF



/*--------------768M-------------------*/
#define DMC_LP4_768_MR1				0x24
#define DMC_LP4_768_MR2				0x12
#define DMC_LP4_768_MR3				0x33
#define DMC_LP4_768_MR22			0x3E
#define DMC_LP4_768_DTMG0			0x450A0808

#if LP4X_ODT_EN(3)
#define DMC_LP4_768_DTMG1_LP4X			0x220B0802
#else
#define DMC_LP4_768_DTMG1_LP4X			0x220B0802
#endif
#if LP4_ODT_EN(3)
#define DMC_LP4_768_DTMG1_LP4			0x220B0802
#else
#define DMC_LP4_768_DTMG1_LP4			0x220B0802
#endif
#define DMC_LP4_768_DTMG2			0x24223c48
#define DMC_LP4_768_DTMG3			0x63050F13
#define DMC_LP4_768_DTMG4			0x22431504
#define DMC_LP4_768_DTMG5			0x00000405
#define DMC_LP4_768_DTMG6			0x00000908
#define DMC_LP4_768_DTMG7			0x00270300
#define DMC_LP4_768_DTMG8			0x11810100
#define DMC_LP4_768_DTMG9			0x00030600
#define DMC_LP4_768_DTMG10			0x150C0002
#if LP4X_ODT_EN(3)
#define DMC_LP4_768_DTMG11_LP4X			0x0b000b00
#define DMC_LP4_768_DTMG12_LP4X			0x163e0e5d
#else
#define DMC_LP4_768_DTMG11_LP4X			0x0b000b00
#define DMC_LP4_768_DTMG12_LP4X			0x163e0e5d
#endif
#if LP4_ODT_EN(3)
#define DMC_LP4_768_DTMG11_LP4			0x0b000b00
#define DMC_LP4_768_DTMG12_LP4			0x16360e4d
#else
#define DMC_LP4_768_DTMG11_LP4			0x0b000b00
#define DMC_LP4_768_DTMG12_LP4			0x16360e4d
#endif

#define DMC_LP4_768_DTMG13			0x01240212
#define DMC_LP4_768_DTMG14			0x0D080C5D
#define DMC_LP4_768_DTMG15			0x01240212
#define DMC_LP4_768_DTMG16			0x0D000124
#define DMC_LP4_768_DTMG17			0x00000000
#define DMC_LP4_768_DTMG18			0x000d0383
#define DMC_LP4_768_DTMG19			0xFFFFFFFF



/*---------------512M------------------*/
#define DMC_LP4_512_MR1				0x14
#define DMC_LP4_512_MR2				0x09
#define DMC_LP4_512_MR3				0x33
#define DMC_LP4_512_MR22			0x3E

#define DMC_LP4_512_DTMG0			0x43060505
#define DMC_LP4_512_DTMG1			0x22090602
#define DMC_LP4_512_DTMG2			0x19163030
#define DMC_LP4_512_DTMG3			0x43040A0D
#define DMC_LP4_512_DTMG4			0x22431504
#define DMC_LP4_512_DTMG5			0x00000405
#define DMC_LP4_512_DTMG6			0x00000707
#define DMC_LP4_512_DTMG7			0x001b0200
#define DMC_LP4_512_DTMG8			0x51010100
#define DMC_LP4_512_DTMG9			0x00030400
#define DMC_LP4_512_DTMG10			0x15080002

#define DMC_LP4_512_DTMG11			0x0b000b00
#define DMC_LP4_512_DTMG12			0x163e0e5d
#define DMC_LP4_512_DTMG13			0x01140209
#define DMC_LP4_512_DTMG14			0x0D080C5D
#define DMC_LP4_512_DTMG15			0x01140209
#define DMC_LP4_512_DTMG16			0x0D000114
#define DMC_LP4_512_DTMG17			0x00000000
#define DMC_LP4_512_DTMG18			0x000d0383
#define DMC_LP4_512_DTMG19			0xFFFFFFFF



/*----------------384M-----------------*/
#define DMC_LP4_384_MR1				0x14
#define DMC_LP4_384_MR2				0x09
#define DMC_LP4_384_MR3				0x33
#define DMC_LP4_384_MR22			0x3E

#define DMC_LP4_384_DTMG0			0x42050404
#define DMC_LP4_384_DTMG1			0x22090502
#define DMC_LP4_384_DTMG2			0x13102829
#define DMC_LP4_384_DTMG3			0x3304080A
#define DMC_LP4_384_DTMG4			0x22431504
#define DMC_LP4_384_DTMG5			0x00000405
#define DMC_LP4_384_DTMG6			0x00000707
#define DMC_LP4_384_DTMG7			0x00150180
#define DMC_LP4_384_DTMG8			0x50C10100
#define DMC_LP4_384_DTMG9			0x00030300
#define DMC_LP4_384_DTMG10			0x15060002

#define DMC_LP4_384_DTMG11			0x0b000b00
#define DMC_LP4_384_DTMG12			0x163e0e5D
#define DMC_LP4_384_DTMG13			0x01140209
#define DMC_LP4_384_DTMG14			0x0d080C5D
#define DMC_LP4_384_DTMG15			0x01140209
#define DMC_LP4_384_DTMG16			0x0d000114
#define DMC_LP4_384_DTMG17			0x00000000
#define DMC_LP4_384_DTMG18			0x000d0383
#define DMC_LP4_384_DTMG19			0xFFFFFFFF


/*---------------256M------------------*/
#define DMC_LP4_256_MR1				0x04
#define DMC_LP4_256_MR2				0x00
#define DMC_LP4_256_MR3				0x33
#define DMC_LP4_256_MR22			0x3E

#define DMC_LP4_256_DTMG0			0x42040303
#define DMC_LP4_256_DTMG1			0x22080402
#define DMC_LP4_256_DTMG2			0x0d082022
#define DMC_LP4_256_DTMG3			0x23040507
#define DMC_LP4_256_DTMG4			0x22431403
#define DMC_LP4_256_DTMG5			0x00000304
#define DMC_LP4_256_DTMG6			0x00000505
#define DMC_LP4_256_DTMG7			0x000d0100
#define DMC_LP4_256_DTMG8			0x50810100
#define DMC_LP4_256_DTMG9			0x00030200
#define DMC_LP4_256_DTMG10			0x15040002

#define DMC_LP4_256_DTMG11			0x0b000b00
#define DMC_LP4_256_DTMG12			0x163e0e5d
#define DMC_LP4_256_DTMG13			0x01040200
#define DMC_LP4_256_DTMG14			0x0d080C5D
#define DMC_LP4_256_DTMG15			0x01040200
#define DMC_LP4_256_DTMG16			0x0d000104

#define DMC_LP4_256_DTMG17			0x00000000
#define DMC_LP4_256_DTMG18			0x000d0383
#define DMC_LP4_256_DTMG19			0xFFFFFFFF


